from epguide.parsers.gazeta.GazetaChannelListParser import GazetaChannelListParser
import unittest

class  GazetaChannelListParserTest(unittest.TestCase):
    def setUp(self):
        self.maxDiff = None
        pass

    def tearDown(self):
        pass

    def testChannel(self):
        p = GazetaChannelListParser()
        f = open("stacje.html", "r")
        buf = f.read()
        channels = [str(c) for c in p.get_channels(buf)]
        f.close()
        expected = ["Channel(id:'431',name:'Polsat News',icon_url:None)", 
                    "Channel(id:'381',name:'Superstacja',icon_url:None)", 
                    "Channel(id:'151',name:'TVN 24',icon_url:None)", 
                    "Channel(id:'397',name:'TVN CNBC',icon_url:None)", 
                    "Channel(id:'31',name:'TVP Info',icon_url:None)", 
                    "Channel(id:'85',name:'Ale Kino!',icon_url:None)", 
                    "Channel(id:'13',name:'Canal+',icon_url:None)", 
                    "Channel(id:'86',name:'Canal+ Film',icon_url:None)", 
                    "Channel(id:'80',name:'CBS Europa',icon_url:None)", 
                    "Channel(id:'36',name:'Cinemax',icon_url:None)", 
                    "Channel(id:'358',name:'Cinemax 2',icon_url:None)", 
                    "Channel(id:'403',name:'Filmbox',icon_url:None)", 
                    "Channel(id:'405',name:'Filmbox Extra',icon_url:None)", 
                    "Channel(id:'438',name:'Filmbox Family',icon_url:None)", 
                    "Channel(id:'406',name:'Filmbox HD',icon_url:None)", 
                    "Channel(id:'14',name:'HBO',icon_url:None)", 
                    "Channel(id:'385',name:'HBO Comedy',icon_url:None)", 
                    "Channel(id:'12',name:'HBO2',icon_url:None)", 
                    "Channel(id:'4',name:'Kino Polska',icon_url:None)", 
                    "Channel(id:'379',name:'MGM HD',icon_url:None)", 
                    "Channel(id:'413',name:'Movies 24',icon_url:None)", 
                    "Channel(id:'467',name:'nFilmHD',icon_url:None)", 
                    "Channel(id:'468',name:'nFilmHD2',icon_url:None)", 
                    "Channel(id:'477',name:'Polsat Film',icon_url:None)", 
                    "Channel(id:'387',name:'TCM',icon_url:None)", 
                    "Channel(id:'389',name:'TV 1000',icon_url:None)", 
                    "Channel(id:'411',name:'Universal Channel',icon_url:None)", 
                    "Channel(id:'377',name:'Wojna i Pok\xc3\xb3j',icon_url:None)", 
                    "Channel(id:'178',name:'Canal+ Gol',icon_url:None)", 
                    "Channel(id:'87',name:'Canal+ Sport',icon_url:None)", 
                    "Channel(id:'335',name:'Canal+ Sport 2',icon_url:None)", 
                    "Channel(id:'380',name:'ESPN America',icon_url:None)", 
                    "Channel(id:'345',name:'ESPN Classic',icon_url:None)", 
                    "Channel(id:'42',name:'Eurosport',icon_url:None)", 
                    "Channel(id:'39',name:'Eurosport 2',icon_url:None)", 
                    "Channel(id:'79',name:'Extreme',icon_url:None)", 
                    "Channel(id:'378',name:'nSport',icon_url:None)", 
                    "Channel(id:'436',name:'Orange Sport',icon_url:None)", 
                    "Channel(id:'475',name:'Polsat Futbol',icon_url:None)", 
                    "Channel(id:'120',name:'Polsat SPORT',icon_url:None)", 
                    "Channel(id:'357',name:'Polsat Sport Extra',icon_url:None)", 
                    "Channel(id:'368',name:'SportKlub',icon_url:None)", 
                    "Channel(id:'393',name:'SportKlub+',icon_url:None)", 
                    "Channel(id:'374',name:'TVP Sport',icon_url:None)", 
                    "Channel(id:'147',name:'AXN',icon_url:None)", 
                    "Channel(id:'366',name:'AXN Crime',icon_url:None)", 
                    "Channel(id:'367',name:'AXN Sci-Fi',icon_url:None)", 
                    "Channel(id:'407',name:'BBC Entertainment',icon_url:None)", 
                    "Channel(id:'78',name:'CBS Action',icon_url:None)", 
                    "Channel(id:'84',name:'CBS Reality',icon_url:None)", 
                    "Channel(id:'370',name:'Comedy Central',icon_url:None)", 
                    "Channel(id:'495',name:'FOX',icon_url:None)", 
                    "Channel(id:'382',name:'Fox Life',icon_url:None)", 
                    "Channel(id:'41',name:'iTV',icon_url:None)", 
                    "Channel(id:'369',name:'Kuchnia.tv',icon_url:None)", 
                    "Channel(id:'412',name:'Scifi Universal',icon_url:None)", 
                    "Channel(id:'497',name:'TVP Seriale',icon_url:None)", 
                    "Channel(id:'408',name:'BBC CBeebies',icon_url:None)", 
                    "Channel(id:'356',name:'Boomerang',icon_url:None)", 
                    "Channel(id:'386',name:'Cartoon Network',icon_url:None)", 
                    "Channel(id:'346',name:'Disney Channel',icon_url:None)", 
                    "Channel(id:'74',name:'Disney XD',icon_url:None)", 
                    "Channel(id:'81',name:'Minimini',icon_url:None)", 
                    "Channel(id:'433',name:'Nickelodeon',icon_url:None)", 
                    "Channel(id:'88',name:'ZigZap/Hyper',icon_url:None)", 
                    "Channel(id:'337',name:'4fun TV',icon_url:None)", 
                    "Channel(id:'89',name:'Mezzo',icon_url:None)", 
                    "Channel(id:'10',name:'MTV Polska',icon_url:None)", 
                    "Channel(id:'359',name:'VH 1 Polska',icon_url:None)", 
                    "Channel(id:'470',name:'VH1 European',icon_url:None)", 
                    "Channel(id:'92',name:'VIVA Polska',icon_url:None)", 
                    "Channel(id:'63',name:'Animal Planet',icon_url:None)", 
                    "Channel(id:'409',name:'BBC Knowledge',icon_url:None)", 
                    "Channel(id:'400',name:'Da Vinci Learning',icon_url:None)", 
                    "Channel(id:'67',name:'Discovery Channel',icon_url:None)", 
                    "Channel(id:'376',name:'Discovery Historia',icon_url:None)", 
                    "Channel(id:'96',name:'Discovery Science',icon_url:None)", 
                    "Channel(id:'97',name:'Discovery World',icon_url:None)", 
                    "Channel(id:'338',name:'Edusat',icon_url:None)", 
                    "Channel(id:'76',name:'National Geographic',icon_url:None)", 
                    "Channel(id:'392',name:'National Geographic Wild',icon_url:None)", 
                    "Channel(id:'15',name:'Planete',icon_url:None)", 
                    "Channel(id:'40',name:'Viasat Explorer',icon_url:None)", 
                    "Channel(id:'38',name:'Viasat History',icon_url:None)", 
                    "Channel(id:'75',name:'13th Street Universal',icon_url:None)", 
                    "Channel(id:'410',name:'BBC Lifestyle',icon_url:None)", 
                    "Channel(id:'375',name:'Discovery HD Showcase',icon_url:None)",
                    "Channel(id:'440',name:'Domo',icon_url:None)", 
                    "Channel(id:'90',name:'Fashion TV',icon_url:None)", 
                    "Channel(id:'466',name:'Investigation Discovery',icon_url:None)", 
                    "Channel(id:'443',name:'Polsat Caf\xc3\xa9',icon_url:None)", 
                    "Channel(id:'442',name:'Polsat Play',icon_url:None)", 
                    "Channel(id:'404',name:'Religia.tv',icon_url:None)", 
                    "Channel(id:'95',name:'TLC',icon_url:None)", 
                    "Channel(id:'66',name:'Travel Channel',icon_url:None)", 
                    "Channel(id:'333',name:'TVN Style',icon_url:None)", 
                    "Channel(id:'145',name:'TVN Turbo',icon_url:None)", 
                    "Channel(id:'390',name:'TVP Historia',icon_url:None)", 
                    "Channel(id:'343',name:'TVP Kultura',icon_url:None)", 
                    "Channel(id:'398',name:'Wedding TV',icon_url:None)", 
                    "Channel(id:'236',name:'BBC HD',icon_url:None)", 
                    "Channel(id:'494',name:'CSB TV',icon_url:None)", 
                    "Channel(id:'8',name:'Polonia 1',icon_url:None)", 
                    "Channel(id:'5',name:'Polsat',icon_url:None)", 
                    "Channel(id:'6',name:'Polsat 2',icon_url:None)", 
                    "Channel(id:'16',name:'Tele 5',icon_url:None)", 
                    "Channel(id:'32',name:'Toya',icon_url:None)", 
                    "Channel(id:'18',name:'TV 4',icon_url:None)", 
                    "Channel(id:'11',name:'TV Puls',icon_url:None)", 
                    "Channel(id:'417',name:'TV Silesia',icon_url:None)", 
                    "Channel(id:'17',name:'TVN',icon_url:None)", 
                    "Channel(id:'7',name:'TVN 7',icon_url:None)", 
                    "Channel(id:'1',name:'TVP 1',icon_url:None)", 
                    "Channel(id:'2',name:'TVP 2',icon_url:None)", 
                    "Channel(id:'435',name:'TVP HD',icon_url:None)", 
                    "Channel(id:'3',name:'TVP Polonia',icon_url:None)"]        
        self.assertEqual(channels, expected)



if __name__ == '__main__':
    unittest.main()

